package com.dk.controller;


import com.dk.model.CraftConstitute;
import com.dk.service.CraftConstituteService;
import com.dk.vo.CraftConstituteVO;
import com.dongdongshop.data.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  工艺流程组成工序 也就是流程与工序的中间表 前端控制器
 * </p>
 *
 * @author wbh
 * @since 2023-03-20
 */
@RestController
@RequestMapping("craftConstitute")
public class CraftConstituteController {

    @Autowired
    private CraftConstituteService craftConstituteService;

    @GetMapping("getInfoList")
    public Result getInfoList(String craftRouteId){
        List<CraftConstituteVO> craftConstituteVOList = craftConstituteService.getInfoList(craftRouteId);
        return Result.OK().setData(craftConstituteVOList);
    }

    @PostMapping("insertInfoCraftConstitute")
    public Result insertInfoCraftConstitute(CraftConstituteVO craftConstituteVO){
        craftConstituteService.insertInfoCraftConstitute(craftConstituteVO);
        return Result.OK();
    }

    @GetMapping("getInfoCraftConstituteById")
    public Result getInfoCraftConstituteById(Integer id){
        CraftConstituteVO craftConstituteVO = craftConstituteService.getInfoCraftConstituteById(id);
        return Result.OK().setData(craftConstituteVO);
    }

    @PostMapping("updateInfoCraftConstituteById")
    public Result updateInfoCraftConstituteById(CraftConstituteVO craftConstituteVO){
        craftConstituteService.updateInfoCraftConstituteById(craftConstituteVO);
        return Result.OK();
    }

    @DeleteMapping("deleteInfoCraftConstituteById")
    public Result deleteInfoCraftConstituteById(Integer id){
        craftConstituteService.deleteInfoCraftConstituteById(id);
        return Result.OK();
    }
}

